﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Text;
using Frame.Lib.Core.User;
using Frame.Lib.Utilities;
using Frame.Lib.Core.Tree;

public partial class Common_DeptUserEx : PageSelectTree
{
    private UserBO user = new UserBO();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //tvList.Attributes.Add("onclick", "SelectUser()");
            BindTree();            
        }
    }

    private void BindTree()
    {
        //List<int> lstSelectIDs = StrUtil.SplitToInt(RestoreIDs);
        //user.BindDeptUserTree(tvList, true, lstSelectIDs);


        List<TreeInfo> list = user.GetDeptUserList();

        StringBuilder sb = new StringBuilder();

        foreach (TreeInfo info in list)
        {
            sb.Append("{ id: " + info.ID + ", pId: " + info.UpperID + ", name: '" + info.Name + "'");

            if (info.UpperID == 0)
            {
                sb.Append(",open:true");
            }

           

            sb.Append("},");


        }

        lblJson.Text = sb.ToString().TrimEnd(',');
    }
}
